<template>
  <div>
    <!-- <el-form :inline="true" :model="formInline" class="demo-form-inline">
      <el-form-item label="按科室：">
        <el-select v-model="formInline.depId" placeholder="请选择科室名称" clearable>
           <el-option
                v-for="item in options"
                :key="item.id"
                :label="item.depName"
                :value="item.id">
           </el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="按医生：">
        <el-select v-model="formInline.depId" placeholder="请选择医生名称" clearable>
          <el-option label="区域一" value="shanghai" />
          <el-option label="区域二" value="beijing" />
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSubmit">查询</el-button>
      </el-form-item>
    </el-form> -->
    <!-- <el-row v-if="doctorShow" :span="16" style="margin-top:10px">
      <el-card>
        <recommmended-doctor />
      </el-card>
    </el-row> -->
    <h3>医生信息</h3>
    <el-table
      :data="dactors"
      border
      :header-cell-style="{'text-align':'center'}"
      :cell-style="{'text-align':'center'}"
      style="width: 100%">
      <el-table-column
        prop="userName"
        label="医生姓名"
        width="180">
      </el-table-column>
       <el-table-column
        prop="phoneNum"
        label="医生手机号"
        width="180">
      </el-table-column>
      <el-table-column
        prop="depName"
        label="所在科室"
        width="180">
      </el-table-column>
      <el-table-column
        prop="remarks"
        label="医生简介">
      </el-table-column>
    </el-table>
     <Pagination
        :total='total_count'
        :currentPage='currentPage'
        :pageSize='pageSize'
        @handleSizeChange="pageSizeChange"
        @handleCurrentChange="currentPageChange"
        style="margin-top:20px"
     />
  </div>
</template>

<script>
import Pagination from '@/components/Form/Pagination.vue'
import RecommmendedDoctor from './recommendedDoctor.vue'
import { getAllDepName,getAllDoctor } from '@/api/user'
export default {
  components: {
    RecommmendedDoctor,
    Pagination
  },
  data() {
    return {
      formInline: {
        depId: '',
        region: ''
      },
      doctorShow: false,
      currentPage:1,//当前选中页
      total_count:10,//总页数
      pageSize:10,//分页条数
      options:[], // 所有科室信息
      dactors:[], // 所有医生信息
    }
  },
  mounted(){
    this.getAllDepName()
    this.getAllDoctor()
  },
  methods: {
    onSubmit() {
      console.log('submit!')
      this.doctorShow = !this.doctorShow
    },
     // pageSize分页条数改变
      pageSizeChange(size){
         this.pageSize = size
      },
      // 当前页数改变
      currentPageChange(page){
         this.currentPage = page
      },
       // 所有科室信息
    async getAllDepName(){
      this.options = await getAllDepName()
    },
    // 获取所有医生信息
    async getAllDoctor(){
      const { records,total,size,pages } = await getAllDoctor() 
      this.dactors = records
      this.total_count = total
    }
  }
}
</script>

<style>

</style>
